package com.ll.listdemo;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author 刘龙
 * @version 1.0
 */
public class ListExercise {
    public static void main(String[] args) {
        List list = new ArrayList();
        for (int i = 0; i < 12; i++) {
            list.add("hello" + i);
        }

        System.out.println(list);
        list.add(1, "ll");
        System.out.println(list);

        System.out.println(list.get(4));

        System.out.println(list.remove(5));
        System.out.println(list);

        System.out.println(list.set(6, "哈哈哈哈哈或"));
        System.out.println(list);

        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            Object obj = iterator.next();
            System.out.println(obj);
        }
    }
}
